A = imread('cameraman.tif'); %read cameraman.tif Greyscale image
figure,imshow(A),title('Original Greyscale Image'); %Display initial image
[m,n] = size(A); % calculate the size vector
for i = 1 : m/2  %traverse vertical dimension m till m/2 
  for j = 1 : n %traverse horizontal dimension completely i.e till n
      tempimg = A(i,j);    %swap the intensity values
      A(i,j) = A(m-i+1,j);
      A(m-i+1,j) = tempimg;
  end
end
figure,imshow(A),title('Vertically Flipped Greyscale Image');